import { createSlice } from '@reduxjs/toolkit';

const slice = createSlice({
  name: 'person',
  initialState: [{ id: '01', name: '老何', age: 18 }],
  reducers: {
    addPerson: (state, action) => {
      console.log(11,state, action);
      return [ action.payload, ...state ]
    }
  }
})

export const { addPerson } = slice.actions
export default slice.reducer